package com.hw.paltfrom.controller.system;
import com.hw.paltfrom.pack.ResponseResult;
import com.hw.paltfrom.rescode.HWSystemCode;
import com.hw.paltfrom.service.system.ExceptionLogServer;
import com.hw.paltfrom.utils.VerifyUtil;
import com.hw.paltfrom.vo.ExceptionLogVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.Map;

/**
 * 异常日志处理
 * 崔孟超
 * 2019年11月6日15:41:47
 */
@RestController
@RequestMapping(value = "/ExceptionLog")
public class ExceptionLogController {
    @Autowired
    private ExceptionLogServer exceptionLogServer;

//    //过滤空Date数据
//    @InitBinder
//    protected void initBinder(WebDataBinder binder) {
//        SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
//        binder.registerCustomEditor(Date.class, new CustomDateEditor(dateFormat, true));
//    }

    /**
     * 查询异常日志
     * @param vo
     * @return
     */
    @RequestMapping(value = "/queryAll")
    public Map<String, Object> Query(ExceptionLogVo vo) {
        Boolean flag = VerifyUtil.verifyParams(vo);
        if (!flag) {
            return ResponseResult.fail(HWSystemCode.PARAMS_ERROR);
        }
        return exceptionLogServer.queryAllList(vo);
    }
}
